package com.edais.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Repository;

import com.edais.domain.AdSpreadCount;
import com.edais.persistence.SpreadMapper;

@Repository

public class SpreadDao {
	@Autowired
	private SpreadMapper spreadMapper;
	
	/**
	 * 点击广告时根据设备唯一标识查询设备是否已存在
	 */
	public AdSpreadCount queryEquipmentInfoForClick(AdSpreadCount adSpreadCount) throws Exception {
		return this.spreadMapper.queryEquipmentInfoForClick(adSpreadCount);
	}
	
	/**
	 * 激活时根据设备唯一标识查询设备是否已存在
	 */
	public AdSpreadCount queryEquipmentInfoForAct(AdSpreadCount adSpreadCount) throws Exception {
		return this.spreadMapper.queryEquipmentInfoForAct(adSpreadCount);
	}
	
	/**
	 * 根据广告商传入信息生成统计信息
	 */
	public void insertEquipmentInfo(AdSpreadCount adSpreadCount) throws Exception {
		this.spreadMapper.insertEquipmentInfo(adSpreadCount);
	}
	
	/**
	 * 激活App更新统计信息
	 */
	public void updateEquipmentInfo(AdSpreadCount adSpreadCount) throws Exception {
		this.spreadMapper.updateEquipmentInfo(adSpreadCount);
	}
	
	/**
	 * 点击>3天时更新点击时间、IP
	 */
	public void updateClickTime(AdSpreadCount adSpreadCount) throws Exception {
		this.spreadMapper.updateClickTime(adSpreadCount);
	}
}
